package br.com.conceito.controle;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

import br.com.conceito.dao.InformacaoGeralDAO;
import br.com.conveito.entidade.InformacaoGeralBean;

@ManagedBean
@SessionScoped
public class InformacaoGeralAction {

	private InformacaoGeralBean informacaoGeralBean = new InformacaoGeralBean();
	private InformacaoGeralDAO informacaoGeralDAO = new InformacaoGeralDAO();
	private List<InformacaoGeralBean> informacaoGeralBeans = new ArrayList<InformacaoGeralBean>();
	
	public void add(){
		informacaoGeralDAO.add(informacaoGeralBean);
		informacaoGeralBean = new InformacaoGeralBean();
	}

	public void remover(){
		InformacaoGeralBean informacaoGeralBean = (InformacaoGeralBean) ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getAttribute("inf");
		
	}
	
	public List<InformacaoGeralBean> getInformacaoGeralBeans() {
		this.informacaoGeralBeans = this.informacaoGeralDAO.getAll();
		return informacaoGeralBeans;
	}

	public InformacaoGeralBean getInformacaoGeralBean() {
		return informacaoGeralBean;
	}

	public void setInformacaoGeralBean(InformacaoGeralBean informacaoGeralBean) {
		this.informacaoGeralBean = informacaoGeralBean;
	}
	
}
